﻿#if !NET45 && !NET46
using System;
using System.Collections.Generic;
using System.Reflection;
using JESAI.HtmlTemplate.Pdf;
using JESAI.HtmlTemplate.Pdf.HtmlPaster;
using JESAI.HtmlTemplate.Pdf.MemoryCache;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.Extensions.DependencyInjection
{
    /// <summary>
    /// Add Dynamic WebApi
    /// </summary>
    public static class JESAIHtmlTemplatePdfServiceExtensions
    {
        /// <summary>
        /// Add Dynamic WebApi to Container
        /// </summary>
        /// <param name="services"></param>
        /// <param name="options">configuration</param>
        /// <returns></returns>
        public static IServiceCollection AddHtmlTemplateExportPdf(this IServiceCollection services)
        {
            services.AddSingleton<IHtmlByRazorTemplateExporter, HtmlByRazorTemplateExporter>();
            services.AddSingleton<IExportPdfByHtmlTemplate, PdfByHtmlTemplateExporter>();
            services.AddSingleton<ICacheService, MemoryCacheService>();
            services.AddMemoryCache();
            return services;
        }       
    }
}
#endif